import UnitSpellEvent from '@/event/UnitSpellEvent';
import MathUtil from '@/MathUtil';
import BaseUtil from '@/BaseUtil';
import SelectUtil from '@/SelectUtil';
import MovementCommon from 'code/Core/Common/MovementCommon';
import EffectCommon from 'code/Core/Common/EffectCommon';
export default class Item_灼烧战矛 {
    static id = 'Arsm';
    static onHit(p: LineMissileConfig, hitBody: unit) {
        DamageSystemInstance.applyFireDamage(hitBody, p.caster, 300);
    }
    constructor() {
        se.onUnitSpellEffect(Item_灼烧战矛.spellEffect, Item_灼烧战矛.id);
    }
    static spellEffect(this: void, d: UnitSpellEvent) {
        let u = d.trigUnit;
        let tarx = d.spellTargetX;
        let tary = d.spellTargetY;
        let x = GetUnitX(u);
        let y = GetUnitY(u);
        let ang = MathUtil.angleBetweenCoords(x, y, tarx, tary);
        let p = MovementCommon.LineMissile({
            missile: 'BurningSpear.mdx',
            distance: 600,
            speed: 600,
            angle: ang,
            caster: u,
            radius: 50,
            is_through: true,
            onHit: Item_灼烧战矛.onHit,
        });
        BaseUtil.onTimer(0.15, (c) => {
            EffectCommon.addEffectAndDeleyRemove('Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl', p.curX, p.curY, 4);
            return c < 7;
        });
        BaseUtil.onTimer(1, (c) => {
            let es = SelectUtil.getEnemyUnitsInLine(u, x, y, 600, ang, 125);
            if (es?.length != 0) {
                for (let e of es) {
                    DamageSystemInstance.applyFireDamage(e, u, 100, null, true);
                }
            }
            return c < 4;
        });
    }
}
